<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
            list-style: none;
        }
        ul {
            display: flex;
            text-align: center;
            line-height: 50px;
        }
        ul li {
            flex: 1;
            background-color: #544f6b;
            color: #8478B3;
        }
        .active {
            background: #fff !important;
            color: #655c89 !important;
        }
    </style>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for="(item, index) in list"
             :class="index === count? 'active':'' "
             @click="change(index)">
                {{ item }}
            </li>
        </ul>
        <div class="box">
            {{ text[count] }}
        </div>
    </div>
    <script src="../vue.js"></script>
    <script>
        new Vue ({
            el: "#app",
            data: {
                list: ["tab1","tab2","tab3"],
                text:["文本1", "文本2", "文本3"],
                count: 0,
            },
            methods: {
                change(index) {
                    this.count = index
                }
            }
        })
    </script>
</body>
</html>